package com.wf.course.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.utils.page.PageBean;
import com.wf.course.service.IKeywordService;
import com.wf.course.dao.IKeywordMapper;
import com.wf.course.model.ad.Keyword;

@Service
@Transactional(rollbackFor=Exception.class)
public class IKeywordServiceImpl implements IKeywordService{
	
	@Autowired
	private IKeywordMapper mapper;

	@Override
	public void indexInfo(PageBean<Keyword> pageBean) {
		// TODO Auto-generated method stub
		pageBean.setResults(this.mapper.queryList(pageBean));
		pageBean.setTotalCount(this.mapper.getTotalCount(pageBean));
		
	}

	@Override
	public void saveOrUpdateKeyword(Keyword keyword) {
		// TODO Auto-generated method stub
		
		//新增
		if (keyword.getId() == null) {
			this.mapper.saveKeyword(keyword);
		//修改
		} else {
		
		this.mapper.updateKeyword(keyword);
	}
 }

	@Override
	public Keyword queryKeywordById(Integer id) {
		// TODO Auto-generated method stub
		return mapper.queryKeywordById(id);
	}

	@Override
	public void deleteById(Integer id) {
		// TODO Auto-generated method stub
		this.mapper.deleteById(id);
		 
	}
 

	
}
